home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / tpdb13.arc / TPDB.DOC < prev    next >
Text File  |  1989-02-13  |  30KB  |  1,208 lines

  1.  
  2.                     (***********************************)
  3.                     (*              TPDB               *)
  4.                     (*  Turbo Pascal Tools for dBASE   *)
  5.                     (*                                 *)
  6.                     (*     Turbo Pascal 5.0 Unit       *)
  7.                     (*    for Accessing dBASE III      *)
  8.                     (*             files.              *)
  9.                     (*                                 *)
  10.                     (*        Copyright 1989           *)
  11.                     (*          Brian Corll            *)
  12.                     (*                                 *)
  13.                     (*       All Rights Reserved       *)
  14.                     (*     dBASE is a registered       *)
  15.                     (* trademark of Ashton-Tate, Inc.  *)
  16.                     (*                                 *)
  17.                     (*  Turbo Pascal is a registered   *)
  18.                     (*  trademark of Borland Int. Corp.*)
  19.                     (*                                 *)
  20.                     (* Version 1.3  February 14, 1989  *)
  21.                     (*                                 *)
  22.                     (***********************************)
  23.  
  24.  
  25.          This Turbo  Pascal 5.0 TPU allows  you to access,search,
  26.          read  and write  database files  that were  created with
  27.          dBASE III  or III Plus, using  55 precompiled procedures
  28.          and functions  written specifically for  these purposes.
  29.          At  present,  it  supports  only  a  single  .DBF and an
  30.          associated index (it's own  brand ofindexes, NOT indexes
  31.          created  by  dBASE)  .  Index  keys  can  be  up  to 254
  32.          characters, but  must be a  single character or  numeric
  33.          field.  No  multiple  keys  are  allowed.  Future  plans
  34.          include support for multiple  indexes and multiple index
  35.          keys, as well as multiple .DBF files open concurrently.
  36.  
  37.          All field types are supported except memo fields.
  38.  
  39.          Questions/comments can  be left for me  on the InterLink
  40.          or FidoNet Pascal or dBASE conferences.
  41.  
  42.          This  program is  being distributed  under the Shareware
  43.          concept.
  44.  
  45.          If you like this program  and use it, a registration fee
  46.          of  $10 is  requested for  non-profit users.  Commercial
  47.          users  MUST   register  for  a   one-time,  royalty-free
  48.          registration  fee  of  $15.  Registered  users  will  be
  49.          entitled  to upgrades  for a  fee of  $5 per upgrade, to
  50.          cover  shipping   and  handling  costs.   See  the  file
  51.          REGISTER.FRM.
  52.  
  53.  
  54.          Write to:
  55.  
  56.                 Ten B.C. Micro Systems
  57.                 Brian Corll
  58.                 102 West Locust Street
  59.                 Mechanicsburg,PA 17055
  60.                 Home : 717-691-0286 Eves. and Weekends
  61.  
  62.          DISCLAIMER
  63.  
  64.          This program is provided "as is" without warranty of any
  65.          kind,  either  express  or  implied,  included  but  not
  66.          limited to  the implied warranty  of merchantability and
  67.          fitness for  a specific purpose.  The entire risk  as to
  68.          the quality and performance of this program is with you.
  69.  
  70.          In no  event will the  author be liable  to you for  any
  71.          damages,  including any  lost profits,  lost savings  or
  72.          other incidental or consequential damages arising out of
  73.          the use of or inability to use this program.
  74.  
  75.  
  76.          (***************************************************)
  77.          (*    Globals            in             TPDB.tpu   *)
  78.          (***************************************************)
  79.  
  80.          The globals  in this TPU  use up only  862 bytes of  the
  81.          data segment !
  82.  
  83.  
  84.          Const
  85.  
  86.          CursorLeft = ^S;
  87.          CursorRight = ^D;
  88.          CursorDown = ^X;
  89.          CursorUp = ^E;
  90.          CursorHome =  ^A;
  91.          CursorEnd = ^F;
  92.          PageUp = ^R;
  93.          PageDown = ^C;
  94.          DelKey = ^G;
  95.          TabKey = #9;
  96.          Return = ^M;
  97.          Escape = ^[;
  98.          UpperCase : Boolean = False;
  99.  
  100.          NoDuplicates = 0;
  101.          Duplicates = 1;
  102.          MaxReal = 3.4E37;
  103.          MinReal = 1.5E-45;
  104.          MaxLong = 2147483647;
  105.          MinLong = -2147483647;
  106.  
  107.          The following are color constants to be used with Normal
  108.          and Reverse to set display  and edit colors, using Turbo
  109.          Pascal's constant folding capabilities.
  110.  
  111.          e.g. to display fields in white on a blue background you
  112.          would set Normal := White+BlueBG;  to edit in black on a
  113.          white background you set Reverse := Black+LightGrayBG.
  114.  
  115.          Black        = $00;       DarkGray     = $08;
  116.          Blue         = $01;       LightBlue    = $09;
  117.          Green        = $02;       LightGreen   = $0A;
  118.          Cyan         = $03;       LighBCyan    = $0B;
  119.          Red          = $04;       LightRed     = $0C;
  120.          Magenta      = $05;       LightMagenta = $0D;
  121.          Brown        = $06;       Yellow       = $0E;
  122.          LightGray    = $07;       White        = $0F;
  123.          Blink        = $80;
  124.  
  125.          BlackBG      = $00;
  126.          BlueBG       = $10;
  127.          GreenBG      = $20;
  128.          CyanBG       = $30;
  129.          RedBG        = $40;
  130.          MagentaBG    = $50;
  131.          BrownBG      = $60;
  132.          LightGrayBG  = $70;
  133.  
  134.  
  135.          Type
  136.  
  137.          Str2 = String[2];
  138.          Str4 = String[4];
  139.          Str5 = String[5];
  140.          Str6 = String[6];
  141.          Str8 = String[8];
  142.          Str10 = String[10];
  143.          Str15 = String[15];
  144.          Str20 = String[20];
  145.          Str30 = String[30];
  146.          Str60 = String[60];
  147.          Str80 = String[80];
  148.          Str132 = String[132];
  149.          CharSet = Set of Char;
  150.          ByteSet = Set of Byte;
  151.  
  152.          FileName = String[66];
  153.          DBRecPtr = ^DBType;
  154.          DBType   = Array[1..4000] of Char;
  155.          DBKey    = String[254];
  156.  
  157.          DBHeader = Record
  158.              DBType    : Byte;
  159.              Year      : Byte;
  160.              Month     : Byte;
  161.              Day       : Byte;
  162.              RecCount  : LongInt;
  163.              Location  : Integer;
  164.              RecordLen : Integer;
  165.              Reserved  : Array[1..20] of Byte;
  166.              Terminator : Char;
  167.              end;
  168.  
  169.          DBField = Record
  170.              FieldName    : Array[1..11] of Char;
  171.              FieldType    : Byte;
  172.              FieldAddress : LongInt;
  173.              FieldLen     : Byte;
  174.              FieldDec     : Byte;
  175.              Reserved     : Array[1..14] of Char;
  176.              end;
  177.  
  178.          HeadPtr = ^DBHeader;
  179.          PosPtr = ^DBEditArray;
  180.          FieldPtr = ^FieldArray;
  181.          DBEditArray = Array[1..2,1..128] of Integer;
  182.          FieldArray  = Array[1..128] of DBField;
  183.  
  184.  
  185.          Const
  186.  
  187.              Up   : CharSet = [CursorUp];
  188.              Down : CharSet = [CursorDown,Return];
  189.              Next : CharSet = [Escape];
  190.  
  191.  
  192.  
  193.          Var
  194.              Normal             : Byte;
  195.              Reverse            : Byte;
  196.              UCKey,IndOpen,
  197.                        DBFOpen  : Boolean;
  198.              DBFileName         : FileName;
  199.              DBFile,TempFile    : File;
  200.              Header             : HeadPtr;
  201.              Fields             : FieldPtr;
  202.              Message            : String[80];
  203.              Positions          : PosPtr;
  204.              DBRecord           : DBRecPtr;
  205.              NumFields,ErrCode  : Integer;
  206.              BC,Ch              : Char;
  207.              TotalRecs,DBRecNum,
  208.                                 : LongInt;
  209.              Y,M,D,DW           : Word;
  210.              NumLen,Decimals,
  211.                 LL,K            : Byte;
  212.              DBIndex            : IndexFile;
  213.              DBIndexName        : FileName;
  214.              Found              : Boolean;
  215.              Start,Stop         : Integer;
  216.  
  217.  
  218.      (************************************************************)
  219.      (*  Documentation for Procedures and Functions in TPDB.tpu  *)
  220.      (************************************************************)
  221.  
  222.  
  223.          AddDBKey procedure
  224.  
  225.          Function
  226.                Adds a key string to the index currently in use.
  227.  
  228.          Declaration
  229.                AddDBKey(FieldNumber : Byte);
  230.  
  231.          Remarks
  232.                FieldNumber is the number of the field in the order of fields
  233.                in the .DBF file structure.
  234.  
  235.          Restrictions
  236.                FieldNumber must be a valid field number in the range 1..128.
  237.  
  238.  
  239.  
  240.  
  241.          *************************
  242.  
  243.          AddDBRec procedure
  244.  
  245.          Function
  246.  
  247.                Adds a new record to the .DBF file in use.
  248.  
  249.          Declaration
  250.  
  251.                AddDBRec;
  252.  
  253.          Remarks
  254.  
  255.                A new record must first be created with a call to the
  256.                NewDBRec procedure.
  257.  
  258.          ************************
  259.  
  260.          Block procedure
  261.  
  262.          Function
  263.  
  264.                Turns on a block cursor.
  265.  
  266.          Declaration
  267.  
  268.                Block;
  269.  
  270.          ************************
  271.  
  272.          BOF function
  273.  
  274.          Function
  275.  
  276.                Returns beginning of file status of a .DBF file.
  277.  
  278.          Declaration
  279.  
  280.                BOF
  281.  
  282.          Result Type
  283.  
  284.                Boolean
  285.  
  286.  
  287.  
  288.          ************************
  289.  
  290.          BuildIndex procedure
  291.  
  292.          Function
  293.  
  294.                 Creates and builds an index file to be associated
  295.                 with a .DBF file.
  296.  
  297.          Declaration
  298.  
  299.                 BuildIndex(IndexName     :     FileName;FNo     :
  300.                 Byte;KeyLen,Status : Integer);
  301.  
  302.  
  303.          Remarks
  304.  
  305.                IndexName can  be a maximum of  66 chars in length
  306.                and is the full path and name of the index file to
  307.                be created.
  308.  
  309.                FNo  is  the  number  of  the  field  in  the .DBF
  310.                structure to be used as the key field.
  311.  
  312.                KeyLen is the length of  the key field. Number are
  313.                stored as  strings in .DBF files,  and can thus be
  314.                used as keys without conversion.
  315.  
  316.                Status  is  defined  as   one  of  two  constants:
  317.                NoDuplicates, or Duplicates,  according to whether
  318.                or  not  duplicate  keys  will  be  allowed in the
  319.                index.
  320.  
  321.          ************************
  322.  
  323.          CheckScreen procedure
  324.  
  325.          Function
  326.  
  327.                Checks  the  current  field  being  edited against
  328.                minimum and maximum limits of fields displayed.
  329.  
  330.          Declaration
  331.  
  332.                CheckScreen(Var CurrPos:Byte;BC:Char;Up,Down:CharSet;
  333.                               Low,High:Byte);
  334.  
  335.          Remarks
  336.  
  337.                CurrPos is the number of the field currently being
  338.                edited in  the editing loop  (see DEMO.pas for  an
  339.                example).
  340.  
  341.                BC is the terminating character when field editing
  342.                has been completed.
  343.  
  344.                Up and  Down are the character  sets which contain
  345.                the terminating characters which allow you to move
  346.                from one  field to another,  up or down.  In TPDB,
  347.                they are declred as constants, as follows:
  348.  
  349.                     Up   : CharSet = [CursorUp];
  350.                     Down : CharSet = [CursorDown,Return];
  351.  
  352.                I first  saw this concept used  by Juan Vegarra in
  353.                his DER.pas data entry routines.
  354.  
  355.                Low and High  are the low and high  numbers of the
  356.                displayed fields.
  357.  
  358.          ************************
  359.  
  360.          CloseDBFile procedure
  361.  
  362.          Function
  363.  
  364.                Closes the currently open .DBF file.
  365.  
  366.          Declaration
  367.  
  368.                CloseDBFile;
  369.  
  370.          Remarks
  371.  
  372.                This procedure is error-checked.
  373.  
  374.          ************************
  375.  
  376.          CloseDBIndex procedure
  377.  
  378.          Function
  379.  
  380.                Closes the index currently in use.
  381.  
  382.          Declaration
  383.  
  384.                CloseDBIndex;
  385.  
  386.          Remarks
  387.  
  388.                This procedure is error-checked.
  389.  
  390.          ************************
  391.  
  392.          DBOpenFile procedure
  393.  
  394.          Function
  395.  
  396.                Opens a .DBF file.
  397.  
  398.          Declaration
  399.  
  400.                DBOpenFile(DBName : FileName);
  401.  
  402.          Remarks
  403.  
  404.                FileName  can  be  up  to  66  chars  long and can
  405.                contain the full path.
  406.  
  407.                This procedure is error-checked.
  408.  
  409.          ************************
  410.  
  411.          DBReset procedure
  412.  
  413.          Function
  414.  
  415.                Resets  a .DBF  file, moving  the file  pointer to
  416.                record 1.
  417.  
  418.          Declaration
  419.  
  420.                DBReset;
  421.  
  422.          Remarks
  423.  
  424.                This procedure is error-checked.
  425.  
  426.          ************************
  427.  
  428.          DelDBKey procedure
  429.  
  430.          Function
  431.                Deletes a key string in the index currently in use.
  432.  
  433.          Declaration
  434.  
  435.                DelDBKey(FieldNumber : Byte);
  436.  
  437.          Remarks
  438.  
  439.                FieldNumber  is the  number  of  the field  in the
  440.                order of fields in the .DBF file structure.
  441.  
  442.          Restrictions
  443.  
  444.                FieldNumber must  be a valid  field number in  the
  445.                range 1..128.
  446.  
  447.  
  448.          *************************
  449.  
  450.  
  451.          Deleted function
  452.  
  453.          Function
  454.  
  455.                Returns True if the  curent record has been marked
  456.                for deletion, False if it has not been marked.
  457.  
  458.          Declaration
  459.  
  460.                Deleted : boolean;
  461.  
  462.  
  463.          ************************
  464.  
  465.          Display procedure
  466.  
  467.          Function
  468.  
  469.                Displays  the   current  record  in   a  partially
  470.                formatted manner.
  471.  
  472.          Declaration
  473.  
  474.                Display;
  475.  
  476.          Remarks
  477.  
  478.                Date fields are formatted as MM/DD/YY.
  479.  
  480.          *************************
  481.  
  482.          EOF function
  483.  
  484.          Function
  485.  
  486.                Returns end-of-file status of a .DBF file.
  487.  
  488.          Declaration
  489.  
  490.                EOF
  491.  
  492.          Return Type
  493.  
  494.                Boolean
  495.  
  496.          ************************
  497.  
  498.          FieldToStr function
  499.  
  500.          Functions
  501.  
  502.                Returns a string read from  a specified field in a
  503.                specified record in a .DBF file.
  504.  
  505.          Declaration
  506.  
  507.                FieldToStr(FieldNumber : Byte) : string;
  508.  
  509.          Remarks
  510.  
  511.                FieldNumber is the number of the field in the .DBF
  512.                file structure. Date fields are not formatted.
  513.  
  514.          ************************
  515.  
  516.          FillRecs procedure
  517.  
  518.          Function
  519.  
  520.                Appends a  specified number of blank  records to a
  521.                .DBF file.
  522.  
  523.          Declaration
  524.  
  525.                FillRecs(NumRecs : LongInt);
  526.  
  527.          ************************
  528.  
  529.          Find procedure
  530.  
  531.          Function
  532.  
  533.                Searches for a string in the currently open index.
  534.  
  535.          Declaration
  536.  
  537.                Find(SearchStr : String);
  538.  
  539.          Remarks
  540.  
  541.                If  the  string  is  found,  a  value  of  True is
  542.                returned in the global  boolean variable Found. If
  543.                the  string  is  not  found,  a  value of False is
  544.                returned in Found.
  545.  
  546.          ************************
  547.  
  548.          Flash procedure
  549.  
  550.          Function
  551.  
  552.                Writes  a string  at a  specified row  and column,
  553.                using  a  specified  attribute,  by  direct  video
  554.                access.
  555.  
  556.          Declaration
  557.  
  558.                Flash(Row,Col, Attr:byte; Str : String);
  559.  
  560.          Remarks
  561.  
  562.                When  setting attribute,  constant folding  can be
  563.                used. See color constants in globals section.
  564.  
  565.          ************************
  566.  
  567.          FlashC procedure
  568.  
  569.          Function
  570.  
  571.                Writes a centered string at a specified row, using
  572.                a specified attribute, by direct video access.
  573.  
  574.          Declaration
  575.  
  576.                FlashC(Row,Attr:Byte;Str : String);
  577.  
  578.          Remarks
  579.  
  580.                See remarks for Flash procedure.
  581.  
  582.          ************************
  583.  
  584.          FlashFill procedure
  585.  
  586.          Function
  587.  
  588.                Fills  a specified  screen block  with a specified
  589.                character and attribute.
  590.  
  591.          Declaration
  592.  
  593.                FlashFill(Row,Col,Rows,Cols,Attr   :   Byte;Ch   :
  594.                Char);
  595.  
  596.          Remarks
  597.  
  598.                See remarks for other Flash procedures.
  599.  
  600.          ************************
  601.  
  602.  
  603.          FlushDB procedure
  604.  
  605.          Function
  606.  
  607.                Flushes records currently in memory to disk file.
  608.  
  609.          Declaration
  610.  
  611.                FlushDB;
  612.  
  613.          Remarks
  614.  
  615.                This procedure is error-checked.
  616.  
  617.  
  618.          ************************
  619.  
  620.          Get procedure
  621.  
  622.          Function
  623.  
  624.                Edits a specified field in the .DBF at a specified
  625.                row and column.
  626.  
  627.          Declaration
  628.  
  629.                Get(FieldNumber,Row,Col : Byte);
  630.  
  631.          Remarks
  632.  
  633.                The following editing keys are active:
  634.  
  635.                Left cursor
  636.                Right Cursor
  637.                Home
  638.                End
  639.                Ctrl-Y (Deletes the entire field.)
  640.  
  641.  
  642.          ************************
  643.  
  644.          GetDBRec procedure
  645.  
  646.          Function
  647.  
  648.                Locates  and reads  a specified  record in  a .DBF
  649.                file.
  650.  
  651.          Declaration
  652.  
  653.                GetDBRec(RecordNumber : LongInt);
  654.  
  655.          ************************
  656.  
  657.  
  658.          GetString procedure
  659.  
  660.          Function
  661.  
  662.                Allows screen  input of a  string, as in  a search
  663.                procedure.
  664.  
  665.          Declaration
  666.  
  667.                GetString(Var Parameter : String; Length, Row, Col
  668.                : Byte) : Char;
  669.  
  670.          ************************
  671.  
  672.          GoBottom procedure
  673.  
  674.          Function
  675.  
  676.                Set the file pointer at the end of file.
  677.  
  678.          Declaration
  679.  
  680.                GoBottom;
  681.  
  682.          ************************
  683.  
  684.          GoTop procedure
  685.  
  686.          Function
  687.  
  688.                Sets the file pointer at the beginning of file.
  689.  
  690.          Declaration
  691.  
  692.                GoTop;
  693.  
  694.          ************************
  695.  
  696.  
  697.          IIF function
  698.  
  699.          Function
  700.  
  701.                Evaluates a boolean variable  and returns a string
  702.                according to the value of the boolean.
  703.  
  704.          Declaration
  705.  
  706.                IIF(BoolVar  : Boolean;IfTrue,IfFalse  : String) :
  707.                String;
  708.  
  709.          ************************
  710.  
  711.  
  712.          JustL function
  713.  
  714.          Function
  715.  
  716.                Left justifies  a string within  a specified field
  717.                length.
  718.  
  719.          Declaration
  720.  
  721.                JustL(InString: String; FieldLen: Integer): String;
  722.  
  723.          ************************
  724.  
  725.          LTrim function
  726.  
  727.          Function
  728.  
  729.                Trims leading spaces from a string.
  730.  
  731.          Declaration
  732.  
  733.                LTrim(InStr: String): String;
  734.  
  735.          ************************
  736.  
  737.          MakeDBIndex procedure
  738.  
  739.          Function
  740.  
  741.                Creates a new index file but does not build it.
  742.  
  743.          Declaration
  744.  
  745.                MakeDBIndex(DBIndexName : FileName;KeyLen,Status :
  746.                Integer);
  747.  
  748.          Remarks
  749.  
  750.                DBIndexName can be a maximum of 66 chars in length
  751.                and is the full path and name of the index file to
  752.                be created. the key field.
  753.  
  754.                KeyLen is the length of  the key field. Number are
  755.                stored as  strings in .DBF files,  and can thus be
  756.                used as keys without conversion.
  757.  
  758.                Status  is  defined  as   one  of  two  constants:
  759.                NoDuplicates, or Duplicates,  according to whether
  760.                or  not  duplicate  keys  will  be  allowed in the
  761.                index.
  762.  
  763.  
  764.          ************************
  765.  
  766.          Mark procedure
  767.  
  768.          Function
  769.  
  770.                Marks the current record for deletion.
  771.  
  772.          Declaration
  773.  
  774.                Mark;
  775.  
  776.  
  777.          ************************
  778.  
  779.  
  780.          NewDBRec procedure
  781.  
  782.          Function
  783.  
  784.                Creates a  new blank record  in memory, ready  for
  785.                editing.
  786.  
  787.          Declaration
  788.  
  789.                NewDBRec;
  790.  
  791.          ************************
  792.  
  793.          NextDBKey procedure
  794.  
  795.          Function
  796.  
  797.                Moves  file record  pointer to  the record  number
  798.                associated with the next key in an index.
  799.  
  800.          Declaration
  801.  
  802.                NextDBKey(FieldNumber : Byte);
  803.  
  804.          Remarks
  805.  
  806.                FieldNumber is the number of the field in the .DBF
  807.                file structure.
  808.  
  809.          ************************
  810.  
  811.          NextRec procedure
  812.  
  813.          Function
  814.  
  815.                Moves  the  file  pointer  to  the next sequential
  816.                record in the file.
  817.  
  818.          Declaration
  819.  
  820.                NextRec;
  821.  
  822.          ************************
  823.  
  824.          OpenDBIndex procedure
  825.  
  826.          Function
  827.  
  828.                Opens an index for search and updating.
  829.  
  830.          Declaration
  831.  
  832.                OpenDBIndex(DBIndexName : FileName;KeyLen,Status :
  833.                Integer);
  834.  
  835.          Remarks
  836.  
  837.                DBIndexName can be a maximum of 66 chars in length
  838.                and is the full path and name of the index file to
  839.                be created. the key field.
  840.  
  841.                KeyLen is the length of  the key field. Number are
  842.                stored as  strings in .DBF files,  and can thus be
  843.                used as keys without conversion.
  844.  
  845.                Status  is  defined  as   one  of  two  constants:
  846.                NoDuplicates, or Duplicates,  according to whether
  847.                or  not  duplicate  keys  will  be  allowed in the
  848.                index.
  849.  
  850.  
  851.          ************************
  852.  
  853.          Pack procedure
  854.  
  855.          Function
  856.  
  857.                Packs  a .DBF  files, removing  records marked for
  858.                deletion.
  859.  
  860.          Declaration
  861.  
  862.                Pack;
  863.  
  864.          ************************
  865.  
  866.          PadL function
  867.  
  868.          Function
  869.  
  870.                Pads  a  string  with  spaces  on  the  left, to a
  871.                specified field length.
  872.  
  873.          Declaration
  874.  
  875.                PadL(InStr: String; FieldLength: Integer): String;
  876.  
  877.          ************************
  878.  
  879.          PadR function
  880.  
  881.          Function
  882.  
  883.                Pads  a  string  with  spaces  on  the right, to a
  884.                specified field length.
  885.  
  886.          Declaration
  887.  
  888.                PadR(InStr: String; FieldLength: Integer): String;
  889.  
  890.  
  891.          ************************
  892.  
  893.          PrevDBKey procedure
  894.  
  895.          Function
  896.  
  897.                Moves   file   pointer   to   the   record  number
  898.                corresponding to the previous key in an index.
  899.  
  900.          Declaration
  901.  
  902.                PrevDBKey(FieldNumber : Byte);
  903.  
  904.          Remarks
  905.  
  906.                FieldNumber is the number of the field in the .DBF
  907.                file structure.
  908.  
  909.          ************************
  910.  
  911.          PrevRec procedure
  912.  
  913.          Function
  914.  
  915.                Moves the file pointer  to the previous sequemtial
  916.                record in the file.
  917.  
  918.          Declaration
  919.  
  920.                PrevRec;
  921.  
  922.          ************************
  923.  
  924.          Prompt procedure
  925.  
  926.          Function
  927.  
  928.                Displays  a prompt  string at  a specified  row an
  929.                column, using direct video writes.
  930.  
  931.          Declaration
  932.  
  933.                Prompt(Row,Col : Byte;PromptStr : Str80);
  934.  
  935.          ************************
  936.  
  937.          PutDBRec procedure
  938.  
  939.          Function
  940.  
  941.                Writes the  current editing record  to a specified
  942.                record number in the .DBF file.
  943.  
  944.          Declaration
  945.  
  946.                PutDBRec(RecordNumber : LongInt);
  947.  
  948.          Remarks
  949.  
  950.                Be sure  that the specified  record number is  the
  951.                same as the one given in the call to GetDBRec.
  952.  
  953.          ************************
  954.  
  955.  
  956.          ReadDBHeader procedure
  957.  
  958.          Function
  959.  
  960.                Reads  the  file  header  of  a  .DBF  file into a
  961.                buffer.
  962.  
  963.          Declaration
  964.  
  965.                ReadDBHeader;
  966.  
  967.          ************************
  968.  
  969.          Recall procedure
  970.  
  971.          Function
  972.  
  973.                Unmarks a record previously marked for deletion.
  974.  
  975.          Declaration
  976.  
  977.                Recall;
  978.  
  979.          ************************
  980.  
  981.          Repl procedure
  982.  
  983.          Function
  984.  
  985.                Replaces  a specified  field  in  a record  with a
  986.                specified string.
  987.  
  988.          Declaration
  989.  
  990.                Repl(FieldNumber : Byte;ReplStr : string);
  991.  
  992.          Remarks
  993.  
  994.                FieldNumber is the number of the field in the .DBF
  995.                file structure.  ReplStr is the  string with which
  996.                the field  is to be replaced.  When replacing date
  997.                fields, remember  that the date string  must be in
  998.                the form "19890214".
  999.  
  1000.          ************************
  1001.  
  1002.          ReplEach procedure
  1003.  
  1004.          Function
  1005.  
  1006.                Replaces  a specified  field in  each record  in a
  1007.                .DBF file with a specified string.
  1008.  
  1009.          Declaration
  1010.  
  1011.                ReplEach(FieldNumber : Byte;ReplStr : String);
  1012.  
  1013.          Remarks
  1014.  
  1015.                FieldNumber is the number of the field in the .DBF
  1016.                file structure.  ReplStr is the  string with which
  1017.                the field  is to be replaced.  When replacing date
  1018.                fields, remember  that the date string  must be in
  1019.                the form "19890214".
  1020.  
  1021.          ************************
  1022.  
  1023.          Replicate function
  1024.  
  1025.          Function
  1026.  
  1027.                Fills  a  string  with  a  specified  number  of a
  1028.                specified character.
  1029.  
  1030.          Declaration
  1031.  
  1032.                Replicate(Ch : Char;Count : word) : String;
  1033.  
  1034.          ************************
  1035.  
  1036.          RTrim function
  1037.  
  1038.          Function
  1039.  
  1040.                Trims trailing blanks from a string.
  1041.  
  1042.          Declaration
  1043.  
  1044.                RTrim(InStr: String): String;
  1045.  
  1046.          ************************
  1047.  
  1048.          Say procedure
  1049.  
  1050.          Function
  1051.  
  1052.                Displays a particular field at a specified row and
  1053.                column.
  1054.  
  1055.          Declaration
  1056.  
  1057.                Say(FieldNumber,Row,Col : Byte);
  1058.  
  1059.          Remarks
  1060.  
  1061.                FieldNumber is  the position of  the field in  the
  1062.                .DBF file structure.
  1063.  
  1064.          ************************
  1065.  
  1066.          SetColor
  1067.  
  1068.          Function
  1069.  
  1070.                Sets foreground and background color before a call
  1071.                to ClrScr.
  1072.  
  1073.          Declaration
  1074.  
  1075.                SetColor(FG,BG : Byte);
  1076.  
  1077.          ************************
  1078.  
  1079.          ShowStatus procedure
  1080.  
  1081.          Function
  1082.  
  1083.                Displays  status of  .DBF  file,  after a  call to
  1084.                ReadDBHeader.
  1085.  
  1086.          Declaration
  1087.  
  1088.                ShowStatus;
  1089.  
  1090.          ************************
  1091.  
  1092.          Sum function
  1093.  
  1094.          Function
  1095.  
  1096.                Sums  a numeric  field in  all records  in a  .DBF
  1097.                file.
  1098.  
  1099.          Declaration
  1100.  
  1101.                Sum(FNo : Byte) : Real;
  1102.  
  1103.          ************************
  1104.  
  1105.          Upper function
  1106.  
  1107.          Function
  1108.  
  1109.                Converts a string to upper case.
  1110.  
  1111.          Declaration
  1112.  
  1113.                Upper(InStr: String): String;
  1114.  
  1115.          ************************
  1116.  
  1117.  
  1118.          Wait procedure
  1119.  
  1120.          Function
  1121.  
  1122.                Displays a prompt, 'Press any key to continue...',
  1123.                and waits for a key press.
  1124.  
  1125.          Declaration
  1126.  
  1127.                Wait;
  1128.  
  1129.          ************************
  1130.  
  1131.          WriteDBHeader procedure
  1132.  
  1133.          Function
  1134.  
  1135.                Updates a .DBF file header.
  1136.  
  1137.          Declaration
  1138.  
  1139.                WriteDBHeader;
  1140.  
  1141.  
  1142.          ************************
  1143.  
  1144.          Zap procedure
  1145.  
  1146.          Function
  1147.  
  1148.                Deletes all records in a .DBF file.
  1149.  
  1150.          Declaration
  1151.  
  1152.                Zap;
  1153.  
  1154.          Remarks
  1155.  
  1156.                CAREFUL  ! This  procedure really  does remove all
  1157.                records, completely rewriting the file.
  1158.  
  1159.          ************************
  1160.  
  1161.          (**** Revision History ****)
  1162.  
  1163.          2/7/89 - Version 1.0 released
  1164.  
  1165.          2/8/89 - Version  1.1 - fixed bug in  numeric input that
  1166.          caused  truncation  of  integers.  Also,  recompiled  in
  1167.          $N-,$E+ state  to allow for  8087 emulation on  non-8087
  1168.          machines. Fixed range error in array indexing.
  1169.  
  1170.          Renamed  unit  TPDB10.tpu  to  TPDB.tpu. Future versions
  1171.          will retain this name.
  1172.  
  1173.          2/10/89 -  Version 1.2 -  Modified indexing routines  to
  1174.          allow for index keys up to 254 characters.
  1175.  
  1176.           Added boolean variable, UCKey,  which allows indexes to
  1177.           be created on upper case form of keys.
  1178.  
  1179.           Added procedures Prompt and Upper.
  1180.  
  1181.           Added procedures Flash, FlashC, and FlashFill.
  1182.  
  1183.           Added CheckScreen procedure.
  1184.  
  1185.           Expanded documentation and added demo files.
  1186.  
  1187.           Temporarily  removed  source  code  from  this doc file
  1188.           pending further additions and  decision on which source
  1189.           to include.
  1190.  
  1191.          2/14/89 - Version 1.3 - Added TPDB error handler.
  1192.  
  1193.                 Improved documentation.
  1194.  
  1195.                 Fixed bug in Display procedure.
  1196.  
  1197.                 Added Sum  and FieldToStr functions,  NextRec and
  1198.                 PrevRec procedures.
  1199.  
  1200.                 Added BOF and EOF functions.
  1201.  
  1202.                 Added PrevDBKey and NextDBKey procedures.
  1203.  
  1204.                 Added Repl and ReplEach procedures.
  1205.  
  1206.                 Added FillRecs procedure.
  1207.  
  1208.